
#ifndef SX_OPENGL_CANVAS_H
#define SX_OPENGL_CANVAS_H

#include <sxCanvas.h>
#include <sxOpenGL_Context.h>

/* Sx library types. */
using Sx::Graphics::Color4f;
using Sx::Interface::Canvas;
using Sx::OpenGL::Graphics::Contexts::OpenGL_Context;

namespace Sx {
namespace OpenGL {
namespace Interface {

class OpenGL_Canvas : public Canvas {
public:
	/*
	 * The elimination of the default constructor is critical to ensuring that
	 * an OpenGL canvas can only be used with a valid OpenGL context (as 
	 * opposed to a context from another graphics library).
	 */
	OpenGL_Canvas(const std::shared_ptr<OpenGL_Context>& context);
	virtual ~OpenGL_Canvas();

	bool initialize();
	void render() const;
	void resize(int width, int height);

	/* Standard Drawing Functions */
	bool drawCircle(float radius, int xCenter, int yCenter, const Color4f& color, unsigned int segmentCount = 60u) const;
	bool drawText(const String& text, int x, int y, const Color4f& color) const;
	bool draw3DText(const String& text, float x, float y, float z, const Color4f& color) const;
	bool drawBorder(int x, int y, int width, int height, unsigned int borderWidth, const Color4f& color) const;
	bool drawRectangle(int x, int y, int width, int height, const Color4f& color, bool drawFromCenter = false) const;
	bool fillRectangle(int x, int y, int width, int height, const Color4f& color, bool drawFromCenter = false) const;

protected:
	/* POINTER_OWNERSHIP: NO */
	std::shared_ptr<OpenGL_Context> context;

	/* Can be used when rendering canvas objects. */
	bool enableDepthTest;
};

}

}

}

#endif
